"""
初始化动态表，再动态表中添加一些数据,方便操作
"""

import os
import sys
import django

base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE","demos.settings")
django.setup()

from api import models


for i in range(1,37):
    new_object = models.News.objects.create(
        cover="https://zj-1323324849.cos.ap-nanjing.myqcloud.com/0test.png",
        content="这是第{0}个测试".format(i),
        topic_id=1,
        user_id=1,
    )


    models.NewsDetail.objects.create(
        key="0test.png",
        cos_path="https://zj-1323324849.cos.ap-nanjing.myqcloud.com/0test.png",
        news=new_object,
    )

    models.NewsDetail.objects.create(
        key="1x.png",
        cos_path="https://zj-1323324849.cos.ap-nanjing.myqcloud.com/1x.png",
        news=new_object,
    )

